package com.wh.testDanLi;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public enum DanLiDemo4 {
    INSTANCE;

    public DanLiDemo4 getInstance(){
        return INSTANCE;
    }

    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        DanLiDemo4 instance1 = DanLiDemo4.INSTANCE;
        //java.lang.NoSuchMethodException: com.wh.testDanLi.DanLiDemo4.<init>()
        Constructor<DanLiDemo4> declaredConstructor = DanLiDemo4.class.getDeclaredConstructor(String.class,int.class);
        declaredConstructor.setAccessible(true);
        DanLiDemo4 instance2 = declaredConstructor.newInstance();
        System.out.println(instance1);
        System.out.println(instance2);
    }
}
